package applet.misc.document;

import java.awt.Component;

import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class EnableDocumentListener implements DocumentListener
{
	private Component component;
	public Component component() { return component; }
	public void setComponent(Component component) { this.component = component; }
	
	private boolean enable;
	public boolean enable() { return enable; }
	public void setEnable(boolean enable) { this.enable = enable; }
	
	public EnableDocumentListener(Component component, boolean enable)
	{
		setComponent(component);
		setEnable(enable);
	}
	
	@Override public void changedUpdate(DocumentEvent e) { component.setEnabled(enable); }
	@Override public void insertUpdate(DocumentEvent e) { component.setEnabled(enable); }
	@Override public void removeUpdate(DocumentEvent e) { component.setEnabled(enable); }
}